import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
import layout from '../layout/index.vue'

type RouteConfig = RouteRecordRaw &
{
	//导航是否显示到左侧   false:不显示
	hidden?: boolean,
	//是否显示顶部tabs切换   false:不显示
	isTabs?: boolean,
	children?: { hidden?: boolean }
};
const routes: Array<RouteConfig> = [
	{
		path: '/',
		name: 'login',
		hidden: false,
		component: () => import('../views/login/login.vue')
	},

	{
		path: '/school',
		name: 'school',
		meta: { title: "学校管理", iconPath: require("@/assets/common/course.png"), selectedIconPath: require("@/assets/common/active_course.png") },
		component: layout,
		children: [
			{
				path: '/school/list',
				name: 'school-list',
				meta: { title: "学校列表" },
				isTabs: false,
				component: () => import('../views/school/school.vue')
			}, {
				path: '/teacher',
				name: 'teacher',
				meta: { title: "老师账号" },
				isTabs: false,
				component: () => import('../views/account/teacher.vue')
			}
			, {
				path: '/student',
				name: 'student',
				meta: { title: "学生账号" },
				isTabs: false,
				component: () => import('../views/account/student.vue')
			}
			, {
				path: '/online',
				name: 'online',
				meta: { title: "在线用户" },
				isTabs: false,
				component: () => import('../views/account/student-online.vue')
			}
		]
	},

	{
		path: '/classroom',
		name: 'classroom',
		meta: { title: "我的课程", iconPath: require("@/assets/common/course.png"), selectedIconPath: require("@/assets/common/active_course.png") },
		component: layout,
		children: [
			{
				path: '/course/list',
				name: 'course-list',
				meta: { title: "课程列表" },
				isTabs: false,
				component: () => import('../views/course/course.vue')
			},
			{
				path: '/course/detail',
				name: 'course-detail',
				meta: { title: "课程详情" },
				isTabs: false,
				hidden: false,
				component: () => import('../views/course/detail.vue')
			},
			{
				path: '/course/plan',
				name: 'course-plan',
				meta: { title: "课纲与教案" },
				isTabs: false,
				hidden: false,
				component: () => import('../views/plan.vue')
			},
			/*{
				path: '/classRoom/list',
				name: 'classRoom-list',
				meta: { title: "课堂列表" },
				isTabs: false,
				component: () => import('../views/classRoom.vue')
			},
			{
				path: '/course/add',
				name: 'course-add',
				meta: { title: "添加课程" },
				isTabs: false,
				component: () => import('../views/classroom/addCourse.vue')
			},*/
			{
				path: '/classroom/add',
				name: 'classroom-add',
				meta: { title: "添加课堂" },
				isTabs: false,
				hidden: false,
				component: () => import('../views/classroom/add.vue')
			},
			 {
				path: '/class_room',
				name: 'class_room',
				meta: { title: "我的课堂" },
				isTabs: false,
				component: () => import('../views/classroom/classRoom.vue')
			},
			{
				path: '/classroom/study',
				name: 'study',
				meta: { title: "课程学习" },
				isTabs: false,
				hidden: false,
				component: () => import('../views/classroom/detail/index.vue')
			}/*,
			{
				path: '/classroom/detail',
				name: 'detail',
				meta: { title: "课堂评价" },
				isTabs: false,
				component: () => import('../views/classroom/detail/index.vue')
			}*/
		]
	},

	{
		path: '/space',
		name: 'space',
		meta: { title: "私域空间", iconPath: require("@/assets/common/learn.png"), selectedIconPath: require("@/assets/common/active_learn.png") },
		component: layout,
		hidden: true,
		children: [
			{
				isTabs: false,
				path: '/space',
				name: 'space-index',
				hidden: false,
				meta: { title: "私域空间" },
				component: () => import('../views/space.vue')
			}
		]
	},

	{
		path: '/studydesk',
		name: 'studydesk',
		meta: { title: "学习台", iconPath: require("@/assets/common/learn.png"), selectedIconPath: require("@/assets/common/active_learn.png") },
		component: layout,
		hidden: false
	},

	{
		path: '/account',
		name: 'account',
		meta: { title: "个人中心", iconPath: require("@/assets/common/account.png"), selectedIconPath: require("@/assets/common/active_account.png") },
		component: layout,
		children: [

			{
				path: '/center/info',
				name: 'center-info',
				meta: { title: "个人中心" },
				isTabs: false,
				component: () => import('../views/center/info.vue')
			},
			/**
			{
				path: '/center/order',
				name: 'center-order',
				meta: { title: "订单列表" },
				isTabs: false,
				component: () => import('../views/center/order.vue')
			}, {
				path: '/center/cart',
				name: 'center-cart',
				meta: { title: "购物车" },
				isTabs: false,
				component: () => import('../views/center/cart.vue')
			}, {
				path: '/center/invoice',
				name: 'center-invoice',
				meta: { title: "发票列表" },
				isTabs: false,
				component: () => import('../views/center/invoice.vue')
			}
			*/
		]

	}
];

const router = createRouter({
	history: createWebHashHistory(),
	routes,
});

export default router;
